﻿module MaxHeap
open Heap

type MaxHeap(A:int32[],count:int32)=
    let  heapSize =ref count
    let  rec MaxHeapify (arr:int [] , heapSize') i =
        let max (arr:int32[]) i j =
            if arr.[i]>arr.[j] then i
            else j
        Heapify (arr,heapSize' ) i max
    member h.Sort() =
        Sort (A,heapSize) MaxHeapify
